﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace TodoList.Mode
{
    /*
    <todo>
    <Name />
    <Description />
    <Priority />
    <DueDate />
    <CompletedStatus />
    </todo>
     */
    public class Todo //: IDataErrorInfo
    {
        public string Id
        {
            get;
            set;
        }
        public string Title
        {
            get;
            set;
        }
        public string Description
        {
            get;
            set;
        }
        public string DueDate
        {
            get;
            set;
        }
        public int CompletedStatus
        {
            get;
            set;
        }
        public string State
        {
            get;
            set;
        }
        public string Priority
        {
            get;
            set;
        }

        //static readonly string[] ValidatedProperties =
        //{
        //    "Priority",
        //    "State","CompletedStatus","DueDate","Description","Title"
        //};

        ///// <summary>
        ///// Returns true if this object has no validation errors.
        ///// </summary>
        //public bool IsValid
        //{
        //    get
        //    {
        //        foreach (string property in ValidatedProperties)
        //        {

        //            if (GetValidationError(property) != null) // there is an error
        //                return false;
        //        }

        //        return true;
        //    }
        //}

        //private string GetValidationError(string propertyName)
        //{
        //    string error = null;

        //    switch (propertyName)
        //    {
        //        case "Title":
        //            error = ValidateTitle();
        //            break;

        //        default:
        //            error = null;
        //            break;
        //            //throw new Exception("Unexpected property being validated on Service");
        //    }

        //    return error;
        //}

        //private string ValidateTitle()
        //{
        //    if (Title.Length > -1) return "Title Empty";
        //    else return null;
        //}


        //#region IDataErrorInfo Members
        //private string error;
        //public string Error
        //{
        //    get
        //    {
        //        return error;
        //    }
        //    set
        //    {
        //        error = value;
        //    }
        //}

        //public string this[string columnName]
        //{
        //    get
        //    {
        //        return GetValidationError(columnName);
        //    }
        //}

        //#endregion
    }
}
